package edu.gatech.app4args.utils;

import edu.gatech.app4args.resources.Globals;

// TODO maybe tie to OverviewSlide?
/**
 * The custom data class for storing slide content and settings while in
 * memory.
 *
 * @author Andrew Lunsford
 */
public class SlideData {
	/** Slide layout type */
	private int type;
	/** Unused in current version, supposed to be for grouping slides */
	private String tag;
	/** A data section for the Title */
	private SlideDataSection title;
	/** A data section for the first content area */
	private SlideDataSection content1;
	/** A data section for the second content area */
	private SlideDataSection content2;

	/**
	 * Creates a new SlideData object, initializing all variables.
	 */
	public SlideData(){
		type = Globals.sType_none;
		tag = "";
		title = new SlideDataSection();
		content1 = new SlideDataSection();
		content2 = new SlideDataSection();
	}

	/**
	 * Creates a SlideData object with the given slidetype.
	 *
	 * @param slidetype the slide layout type
	 */
	public SlideData(int slidetype){
		this();
		type = slidetype;
	}

	/**
	 * Adds data to the title section.
	 *
	 * @param str the data to add
	 */
	public void addTitle(String str){
		title.addContent(str);
	}

	/**
	 * Adds data to the content 1 section.
	 *
	 * @param str the data to add
	 */
	public void addContent1(String str){
		content1.addContent(str);
	}

	/**
	 * Adds data to the content 2 section.
	 *
	 * @param str the data to add
	 */
	public void addContent2(String str){
		content2.addContent(str);
	}

	public int getType(){
		return type;
	}

	public String getTag(){
		return tag;
	}

	public void setTag(String tag) {
		this.tag = tag;
	}

	public SlideDataSection getSection(int section){
		if(section==Globals.section_title)
			return title;
		if(section==Globals.section_content1)
			return content1;
		return content2;
	}

	public SlideDataSection getTitle(){
		return title;
	}

	public SlideDataSection getContent1(){
		return content1;
	}

	public SlideDataSection getContent2(){
		return content2;
	}

	/**
	 * Prints out a representation of all data contained in the SlideData object.
	 */
	public void printString(){
		String out = "=============================\n";
		out += "Type:     "+type+"\n";
		out += "Tag:      "+tag+"\n";
		out += "Title:\n";
		out += title.toString();
		out += "Content1:\n";
		out += content1.toString();
		out += "Content2:\n";
		out += content2.toString();
		out += "=============================\n";
		System.out.println(out);
	}
}
